#!/usr/bin/perl
#
# A quite brutal approach to writing out
# a list of Linux user groups
#
use FileTable;
# use the prewritten file of per-country data
do "temp/countrydata.pl";

$groups = FileTable::open("db/usergroups");
while ($key = $groups->each()) {
    $memtab{$key} = $groups->getclean($key);
    ++ $groupcount;
}
print <<EoF;
<html><head>
<title>Linux User Groups registered with the Linux Counter</title>
</head><body bgcolor="white">
<h1><img src="/gifs/Logo-small.png" alt="Linux Counter Logo">
Linux User Groups</h1>
This is not the best list of Linux user groups.
See <a href="http://lugww.counter.li.org/">the Linux User Groups World Wide</a>
for a better maintained list.
<p>
This page is just a dump of the information that existed in the Linux Counter
prior to the closing of this part of the database; take it as a
snapshot only!
<p>
Currently, there are $groupcount groups listed.
<p>
Enjoy!
EoF
for $r (sort {"\L$a->{placeid}" cmp "\L$b->{placeid}" ||
		  $a->{name} cmp $b->{name}} values(%memtab)) {
    if ($r->{country} ne $prevcountry) {
	print "</table>" if $prevcountry;
	print "<h2>$country->{$r->{country}}->{longname} ($r->{country})</h2>\n";
	$prevcountry = $r->{country};
	print "<table>\n";
    }
    my $key = $r->key();
    print "<tr><td>";
    if ($r->{city}) {
	print "$r->{city}: ";
    }
    print "<td><a href=\"/cgi-bin/runscript/display-group.cgi?group=$key\">$r->{name}</a><br>\n";
# A temporary measure: print record number, for easier dup weed
    print "<td>$key";
}
print "</table>\n";
$date = localtime();
print <<EoF;
<hr>
<a href="/"><img src="/gifs/leftsign.gif" alt="Back ">
to the Linux Counter main page</a>
<address>webmaster&#x40;counter.li.org</address>
Last updated: $date
</body></html>
EoF


    
	
    

